<!--Generate by Kevin's CodeBuilder -->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
	<meta charset="UTF-8">
	<title>bui-ssm快速开发框架</title>

	<head th:include="source::header"></head>
</head>

<body>
	<div class="form_main_wrap">
		<div class="form_condition"></div>
		<div class="form_grid">
			<table id="datagrid"></table>
		</div>
	</div>
	</div>
	<script type="application/javascript" th:inline="javascript">
		var curdObj,
			height = 300,
			gridOpts = [(${ dataGridJson })];//获取datagrid配置json
		var title = "[(${Lang.org_windowTitle})]";//国际化语言
		gridOpts.title = title;
		$(function () {
			var dg = $("#datagrid");			
			gridOpts.oprColWidth = 300;
			gridOpts.setParams = function(){
				return {pid :"0" };
			};
			curdObj = new $B.CURD(dg, gridOpts);
		});		
		function formatType(cData,rData){
			if(cData === 1){
				return "[(${Lang.org_parent})]";
			}
			return "[(${Lang.org_child})]";
		}
		
		//打开form.html
		function _openForm(prs, isUpdate, rowData) {
			var opts = {
				dataType: 'html',
				title: title,
				width: 700,
				height: height,
				params:{
					pid : prs.id
				}
			};
			if (isUpdate && rowData) {
				opts.rowData = rowData;
			}
			curdObj.window(opts, isUpdate);
		};
		/******工具栏事件集合******/
		window.toolMethods = {
			addFn: function (prs) {	
				prs.id = 0;
				_openForm(prs);
			},
			updateFn: function (prs) {
				prs.id = 0;
				_openForm(prs, true);
			},
			deleteFn: function (prs) {
				curdObj.delChecked();
			},
			lineUpdateFn: function (prs) {
				_openForm(prs, true, prs);
			},
			lineDeleteFn: function (prs) {
				curdObj.deleteData([prs.id]);
			},
			lineAddFn: function (prs) {
				_openForm(prs);
			},
			lineChildFn:function(prs){
				var opts = {
					dataType:'iframe',
					title:title+"["+prs.orgName+"]",
					full:true,
					content: $B.getHttpHost(ctxPath) + "org/page/tree?pid="+prs.id
				};					
				$B.window(opts);
			}
		};
	</script>
</body>

</html>